
\begin{algorithm}
\caption{Calc’s algorithm}\label{fig:calc}
\begin{algorithmic}[0]
\Function{Calc}{}
 \ForAll{$\rho \in \Syn \cup \Reac$}
 \quad  $w_{\rho}'=\max(w_{\rho}+1,D)$
 \EndFor
\ForAll{$\entity\in\entities$}
  \State $\lev_\entity'=\lev_\entity $ \qquad $\refr_\entity'=\refr_\entity$ \qquad $\birth_\entity'=\inc{D}{\birth_\entity}$
  \If{ $\life(\lev_\entity) \neq \omega$ } \quad  $\refr_\entity'= \refr_\entity + 1$
   \EndIf
\If {$ \refr_\entity > \life(\lev_\entity)$} \quad  $\lev_\entity'= \max(0, \lev_\entity -1)$ \qquad $\refr_\entity'= 0$
\EndIf
\EndFor

\ForAll{$\beta \in \Syn $}
 \If{
 $\bigwedge_{(a, \level{a}) \in A_{\beta}}(\lev_a \geq \level{a} \wedge  \birth[\level{a}] \geq \dur{\beta} ) \quad   \wedge$ \\
 \hspace{1.45cm}$\bigwedge_{(i, \level{i}) \in I_{\beta}}(\lev_i < \level{i} \wedge \birth[\level{i}] \geq \dur{\beta} )  \quad \wedge \quad 
  (w_{\beta} \geq \dur{\beta}  )$ \ }
%  
%  
%  \parbox[b]{8cm}
%   {$
%  \begin{array}{l}
%  \bigwedge_{(a, \level{a}) \in A_{\beta}}(\lev_a \geq \level{a} \wedge  \birth[\level{a}] \geq \dur{\beta} ) \quad   \wedge \\
%  \bigwedge_{(i, \level{i}) \in I_{\beta}}(\lev_i < \level{i} \wedge \birth[\level{i}] \geq \dur{\beta} )  \quad \wedge \quad 
%   (w_{\beta} \geq \dur{\beta}  )
%  \end{array}
% $}
%}
 \State $w'_{\beta} = 0$
   \ForAll{$ (r,v)\in R_{\beta}$} 
   \quad  $\lev_r'= \lev_r' +v $
   \qquad  $\refr_r'= 0$
   \EndFor
\EndIf
\EndFor

\ForAll{$ \entity \in \entities$} 
 \State $\lev_r'= \max(0, \min(\lev_r', \setlev_r-1 )$ 
 
 \If{$\lev_\entity' - \lev_\entity<0$}
   \quad $  \birth_\entity'=\birth'_\entity\sub{0}{[\lev_\entity'+1\mydots \lev_\entity]}$
 \EndIf
 \If{$\lev_\entity' - \lev_\entity>0$}
  \quad $\birth_\entity'=\birth_\entity'\sub{0}{[ \lev_\entity+1 \mydots \lev_\entity']}$
 \EndIf
\EndFor
\State \textbf{return} $\bigwedge_j x'_j=c_j$ 
\EndFunction
\end{algorithmic}
where $x_j'$ is the variable labeling  an output arc of $t_c$ and $c_j$ is its evaluation via $\mathit{Calc}$ 

\end{algorithm}










